package com.aef.utils;

import java.math.BigInteger;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;

/**
 * Created by cyb on 2016/8/17 0017.
 */
public class MessageDigestUtils {
	public static String sha(String text){
		BigInteger sha =null;
		MessageDigest messageDigest = null;
		try {
			messageDigest = MessageDigest.getInstance("SHA-1");
		} catch ( NoSuchAlgorithmException e ) {
			throw new RuntimeException("加密失败,原因是"+e.getMessage());
		}
		messageDigest.update(text.getBytes());
		sha = new BigInteger(messageDigest.digest());
		return sha.toString();
	}
}
